/**
 * 渠道运营－申诉处理
 */
define(function (require, exports, module) {
    require('authorize');
    var util = require('util');
    var ui = require('ui');
    var angular = require("angular");
    require("angular-ui");
    require("angular-route");
    require("angular-interceptor");
    require("datepicker");
    require("./treated");
    require("./untreated");
    require('service/ng_service/projectService');
    require('permission');
    require('global');

    var app = angular.module('app', ['ngRoute', 'ngUI', 'Treated','ngInterceptor','Untreated'])
        .config(['$routeProvider', function ($routeProvider) {
            $routeProvider
                .when('/untreated', {templateUrl: 'inc/untreated.html'})
                .when('/treated', {templateUrl: 'inc/treated.html'})
                .otherwise({redirectTo: '/untreated'});
        }])
        .controller('MainController', ['$rootScope', '$scope', '$location', '$http','projectList',
            function ($rootScope, $scope, $location, $http,projectList) {
                $scope.tabs = [
                    {value: '/untreated', name: '待处理'},
                    {value: '/treated', name: '已处理'}
                ];
                $scope.current = $location.path();
                $rootScope.$on('$routeChangeSuccess', function () {
                    $scope.current = $location.path();
                });
                projectList.then(
                    function (res) {
                        $scope.projectList = res.data.data;
                        $scope.current = $location.path();
                    }
                );
            }
        ]);

    angular.bootstrap(document, ['app']);
});